package presenter;

import java.util.List;

import base.BasePresenter;
import base.ResultCallBack;
import bean.BooksBean;
import model.BooksModel;
import view.BooksView;

/**
 * Created by 裘翔 on 2019/11/6.
 */

public class BooksPresenter extends BasePresenter<BooksView> implements ResultCallBack<List<BooksBean>> {
    private BooksModel booksModel;
    public BooksPresenter(){
        this.booksModel=new BooksModel();
        addModel(booksModel);
    }
    public void loadData() {
          booksModel.loadData(this);
    }


    @Override
    public void onSuccess(List<BooksBean> booksBeans) {
        if (mView!=null){
            mView.onSuccess(booksBeans);
        }
    }

    @Override
    public void onFail(String error) {
        if (mView!=null)
            mView.showToast(error);
             mView.onFailed(error);
    }
}
